﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_ManufactureList.cshtml";
}
<script type="text/javascript">
    var status = '@ViewBag.status';
    var number = '@ViewBag.number';
    $(function () {
        initControl();
    });
    function initControl() {
        if (status == 'I') {
            
        } else if (status == 'U') {
            $("#FProductNO").prop("disabled", true);
            var data = eval(@Html.Raw(ViewBag.oldEntity));
            setDataByJson("#form1", data);
            if ($('#FSign').val() == '1') {
                $('#FSignBox').prop("checked", true);
            } else {
                $('#FSignBox').prop("checked", false);
            }
        }
        initBindSelect("#form1");
    }
    function btn_type() {
        var title = '选择参考车型';
        var url = '/BOM/Manufacture/ChooseCarModel?numbers=' + $("#FElseExplain").val();
        $.detailOpenTop({
            id: "Detail",
            title: title,
            url: url
        });
    }
    function btn_ok() {
        if ($('#FSignBox').prop("checked")) {
            $('#FSign').val("1");
        } else {
            $('#FSign').val("0");
        }
        submitForm();
    }
    function submitForm() {
        if (!$('#form1').formValid()) {
            return false;
        }
        $.submitForm({
            url: "/BOM/Manufacture/SubmitProcessRouteCateForm?status=" + status + "&keyValue=" + number,
            param: $("#form1").formSerialize(),
            success: function () {
                parent.reloadGrid();
                parent.$.detailClose();
            }
        })
    }
    function btn_cancel() {
        parent.$.detailClose();
    }
    function do_set_carmodel(val) {
        $("#FElseExplain").val(val);
        $.detailCloseTop();
    }
</script>
<div class="ui-layout" id="layout" style="height: 90%; width: 100%;">
    <form id="form1">
        <div style="width:930px;margin:0 auto;">
            <table class="form" style="width:900px;text-align:right;margin:15px;border-bottom:2px solid #ccc;">
                <tr>
                    <td class="formValue" width="180px;">
                        <div class="btn-group dialog-title">
                           @(ViewBag.status == "U" ? "修改" : "新增")台套目录信息
                        </div>
                    </td>
                    <td class="formValue input-width-185" style="width:420px;">
                        &nbsp;
                    </td>
                    <td style="width: 300px; padding: 5px 10px;">
                        <div class="btn-group" style="margin-right:20px;">
                            <a id="btn_ok" class="btn btn-primary center-block" onclick="btn_ok()"><span class="glyphicon glyphicon-ok"></span> 确认</a>
                        </div>
                        <div class="btn-group">
                            <a id="btn_cancel" class="btn btn-primary center-block" onclick="btn_cancel()"><span class="glyphicon glyphicon-remove"></span> 取消</a>
                        </div>
                    </td>
                </tr>
            </table>
            <table class="form" style="width: 900px;margin-left:15px;">
                <tr>
                    <th class="formTitle" style="width:100px;">产品编号</th>
                    <td class="formValue input-width-185" style="width:280px;">
                        <input id="FProductNO" name="FProductNO" type="text" class="form-control required" value="" />
                        <input id="FProductID" name="FProductID" type="hidden" value="" />
                    </td>
                    <th class="formTitle" style="width:100px">&nbsp;</th>
                    <td class="formValue">
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">产品名称</th>
                    <td class="formValue input-width-320" colspan="3">
                        <input id="FProductName" name="FProductName" type="text" class="form-control required" value="" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">特点描述</th>
                    <td class="formValue input-width-480" colspan="3">
                        <input id="FFeatureExplain" name="FFeatureExplain" type="text" class="form-control" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">产品状态</th>
                    <td class="formValue input-width-140" colspan="3">
                        <select id="FProductClass" name="FProductClass" class="form-control">
                            <option value="">&nbsp;</option>
                            @foreach (var item in ViewBag.productClass)
                            {
                                <option value="@item.FTypeNO">@item.FTypeNO @item.FTypeName</option>
                            }
                        </select>
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">参考车型</th>
                    <td class="formValue input-width-740" colspan="3">
                        <div class="btn-group">
                            <input id="FElseExplain" name="FElseExplain" type="text" class="form-control" readonly="readonly" />
                        </div>
                        <div class="btn-group">
                            <a id="btn_type" class="btn btn-primary center-block btn-1" onclick="btn_type()"><span class="glyphicon glyphicon-search"></span></a>
                        </div>

                    </td>
                </tr>
                <tr>
                    <th class="formTitle">明细维护</th>
                    <td class="formValue">
                        <input id="FSign" name="FSign" type="hidden" value="" />
                        <input id="FSignBox" name="FSignBox" class="category" type="checkbox" value="" />
                    </td>
                    <th class="formTitle">&nbsp;</th>
                    <td class="formValue input-width-320">
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">操作人员</th>
                    <td class="formValue input-width-140" colspan="3">
                        <input id="FOpreateBy" name="FOpreateBy" type="text" class="form-control" readonly="readonly" value="@ViewBag.currUser" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">输入时间</th>
                    <td class="formValue input-width-140" colspan="3">
                        <input id="FOpreateTime" name="FOpreateTime" type="text" class="form-control" readonly="readonly" value="@DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")" />
                    </td>
                </tr>
            </table>
        </div>
    </form>
</div>

